﻿@model Bit.Api.Models.InvoiceModel
<html>
<head>
    <style>
        body {
            font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
            font-size: 18px;
        }

        h1, h2, h3, h4, h5 {
            font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
        }

        table {
            width: 100%;
        }

            table th, table td {
                text-align: left;
                padding: 5px 0;
                vertical-align: top;
            }

            table.items {
                border-collapse: collapse;
                border: 1px solid black;
            }

                table.items th, table.items td {
                    padding: 5px;
                    border: 1px solid darkgray;
                }

        .right {
            text-align: right;
        }

        .paid {
            margin-top: 50px;
            font-size: 60px;
            text-align: center;
            color: darkgreen;
        }

        .number {
            float: right;
            text-align: right;
            font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
        }
    </style>
</head>
<body>
    <div class="number">@Model.InvoiceNumber</div>
    <h1>INVOICE</h1>
    <p>
        @if(!string.IsNullOrWhiteSpace(Model.InvoiceDate))
        {
            <b>Date:</b> @Model.InvoiceDate<br />
        }
        @if(!string.IsNullOrWhiteSpace(Model.InvoiceDueDate))
        {
            <b>Due Date:</b> @Model.InvoiceDueDate
        }
    </p>
    <table>
        <tbody>
            <tr>
                <td width="50%">
                    <h2>From</h2>
                    <p>
                        <b>8bit Solutions LLC</b><br />
                        @Model.OurAddress1<br />
                        @Model.OurAddress2<br />
                        @Model.OurAddress3
                    </p>
                </td>
                <td width="50%">
                    <h2>To</h2>
                    <p>
                        <b>@Model.CustomerName</b><br />
                        @if(!string.IsNullOrWhiteSpace(Model.CustomerAddress1))
                        {
                            @Model.CustomerAddress1<br />
                        }
                        @if(!string.IsNullOrWhiteSpace(Model.CustomerAddress2))
                        {
                            @Model.CustomerAddress2<br />
                        }
                        @if(!string.IsNullOrWhiteSpace(Model.CustomerAddress3))
                        {
                            @Model.CustomerAddress3<br />
                        }
                        @if(!string.IsNullOrWhiteSpace(Model.CustomerCountry))
                        {
                            @Model.CustomerCountry
                        }
                    </p>
                    @if(Model.UsesVat)
                    {
                        <p>VAT @Model.CustomerVatNumber</p>
                    }
                </td>
            </tr>
        </tbody>
    </table>
    <h2>Items</h2>
    <table class="items">
        <thead>
            <tr>
                <th>Description</th>
                @if(Model.UsesVat)
                {
                    <th class="right" style="width: 100px;">VAT %</th>
                    <th class="right" style="width: 100px;">VAT</th>
                }
                <th class="right" style="width: 100px;">Total</th>
            </tr>
        </thead>
        <tbody>
            @foreach(var item in Model.Items)
            {
                <tr>
                    <td>@item.Description</td>
                    @if(Model.UsesVat)
                    {
                        <td class="right">0</td>
                        <td class="right">0.00</td>
                    }
                    <td class="right">@item.Amount</td>
                </tr>
            }
        </tbody>
    </table>
    <h2>Totals</h2>
    <b>Subtotal:</b> @Model.SubtotalAmount<br />
    @if(Model.UsesVat)
    {
        <b>Total VAT:</b> @Model.VatTotalAmount<br />
    }
    <br />
    <b>Total:</b> USD @Model.TotalAmount
    @if(Model.Paid)
    {
        <div class="paid">PAID</div>
    }
</body>
</html>
